<?php
$section = 'newsletter';

$titre = _LB_NEWSLETTER_MANAGEMENT;
$smarty->assign("titre", $titre);

$act = Request::getIntNumber('act');

Session::setBackLink($section);

$newsletter = new Newsletter();
$newsletter->orderBy("EMAIL ASC");
$newsletter->find();

$letter = new Newsletter();

if ($act == 1)
{
	$letter->EMAIL = strtolower(trim(Request::get('EMAIL')));
    
	if ($letter->validateInput())
	{
		$letter->insert();

		redirect($backlink);
	}
}

$cfer = new Cfer(array(
	_LB_ACCUEIL => Utils::getHomeLink(),
	_LB_NEWSLETTER_MANAGEMENT => Utils::getCurrentLink()));

$smarty->assign('cfer', $cfer);
$smarty->assign('newsletter', $newsletter);
$smarty->assign('letter', $letter);

$smarty->display('newsletter_list.html');